Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method Signature Bugfixes #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Spozder
Copy link

@Spozder Spozder commented Apr 30, 2024

Before

❯ gem install pkg/bitset-1.2.1.gem
Building native extensions. This could take a while...
ERROR:  Error installing pkg/bitset-1.2.1.gem:
	ERROR: Failed to build gem native extension.

    current directory: /Users/spozder/.gem/ruby/3.1.5/gems/bitset-1.2.1/ext/bitset
/Users/spozder/.rubies/ruby-3.1.5/bin/ruby -I /Users/spozder/.rubies/ruby-3.1.5/lib/ruby/3.1.0 extconf.rb
creating Makefile

current directory: /Users/spozder/.gem/ruby/3.1.5/gems/bitset-1.2.1/ext/bitset
make DESTDIR\= sitearchdir\=./.gem.20240430-4287-71j6hm sitelibdir\=./.gem.20240430-4287-71j6hm clean

current directory: /Users/spozder/.gem/ruby/3.1.5/gems/bitset-1.2.1/ext/bitset
make DESTDIR\= sitearchdir\=./.gem.20240430-4287-71j6hm sitelibdir\=./.gem.20240430-4287-71j6hm
compiling bitset.c
bitset.c:83:33: warning: function 'raise_index_error' could be declared with attribute 'noreturn' [-Wmissing-noreturn]
static void raise_index_error() {
                                ^
bitset.c:318:18: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    int length = RSTRING_LEN(s);
        ~~~~~~   ^~~~~~~~~~~~~~
/Users/spozder/.rubies/ruby-3.1.5/include/ruby-3.1.0/ruby/internal/core/rstring.h:52:27: note: expanded from macro 'RSTRING_LEN'
#define RSTRING_LEN       RSTRING_LEN
                          ^
bitset.c:509:16: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    int alen = RARRAY_LEN(index_array);
        ~~~~   ^~~~~~~~~~~~~~~~~~~~~~~
/Users/spozder/.rubies/ruby-3.1.5/include/ruby-3.1.0/ruby/internal/core/rarray.h:68:36: note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN                 rb_array_len                 /**< @alias{rb_array_len} */
                                   ^
bitset.c:605:5: error: incompatible function pointer types passing 'VALUE (VALUE, VALUE)' (aka 'unsigned long (unsigned long, unsigned long)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-function-pointer-types]
    rb_define_method(cBitset, "size", rb_bitset_size, 0);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/spozder/.rubies/ruby-3.1.5/include/ruby-3.1.0/ruby/internal/anyargs.h:287:135: note: expanded from macro 'rb_define_method'
#define rb_define_method(klass, mid, func, arity)           RBIMPL_ANYARGS_DISPATCH_rb_define_method((arity), (func))((klass), (mid), (func), (arity))
                                                                                                                                      ^~~~~~
/Users/spozder/.rubies/ruby-3.1.5/include/ruby-3.1.0/ruby/internal/anyargs.h:276:1: note: passing argument to parameter here
RBIMPL_ANYARGS_DECL(rb_define_method, VALUE, const char *)
^
/Users/spozder/.rubies/ruby-3.1.5/include/ruby-3.1.0/ruby/internal/anyargs.h:254:72: note: expanded from macro 'RBIMPL_ANYARGS_DECL'
RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _00(__VA_ARGS__, VALUE(*)(VALUE), int); \
                                                                       ^
bitset.c:649:5: error: incompatible function pointer types passing 'VALUE (VALUE, VALUE)' (aka 'unsigned long (unsigned long, unsigned long)') to parameter of type 'VALUE (*)(VALUE)' (aka 'unsigned long (*)(unsigned long)') [-Wincompatible-function-pointer-types]
    rb_define_method(cBitset, "reverse", rb_bitset_reverse, 0);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/spozder/.rubies/ruby-3.1.5/include/ruby-3.1.0/ruby/internal/anyargs.h:287:135: note: expanded from macro 'rb_define_method'
#define rb_define_method(klass, mid, func, arity)           RBIMPL_ANYARGS_DISPATCH_rb_define_method((arity), (func))((klass), (mid), (func), (arity))
                                                                                                                                      ^~~~~~
/Users/spozder/.rubies/ruby-3.1.5/include/ruby-3.1.0/ruby/internal/anyargs.h:276:1: note: passing argument to parameter here
RBIMPL_ANYARGS_DECL(rb_define_method, VALUE, const char *)
^
/Users/spozder/.rubies/ruby-3.1.5/include/ruby-3.1.0/ruby/internal/anyargs.h:254:72: note: expanded from macro 'RBIMPL_ANYARGS_DECL'
RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _00(__VA_ARGS__, VALUE(*)(VALUE), int); \
                                                                       ^
3 warnings and 2 errors generated.
make: *** [bitset.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/spozder/.gem/ruby/3.1.5/gems/bitset-1.2.1 for inspection.
Results logged to /Users/spozder/.gem/ruby/3.1.5/extensions/x86_64-darwin-23/3.1.0/bitset-1.2.1/gem_make.out

After fixing:

Results logged to /Users/spozder/.gem/ruby/3.1.5/extensions/x86_64-darwin-23/3.1.0/bitset-1.2.1/gem_make.out
❯ git stash pop
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   VERSION
	modified:   ext/bitset/bitset.c

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	.gem
	Gemfile
	Gemfile.lock

no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (c49d3b38c3ba46fc73372e51cb977730b4d5fe96)
❯ rake build
WARNING:  open-ended dependency on rake (>= 0) is not recommended
  use a bounded requirement, such as '~> x.y'
WARNING:  open-ended dependency on jeweler (>= 0) is not recommended
  use a bounded requirement, such as '~> x.y'
WARNING:  open-ended dependency on rspec (>= 0) is not recommended
  use a bounded requirement, such as '~> x.y'
WARNING:  See https://guides.rubygems.org/specification-reference/ for help
  Successfully built RubyGem
  Name: bitset
  Version: 1.2.1
  File: bitset-1.2.1.gem
❯ gem install pkg/bitset-1.2.1.gem
Building native extensions. This could take a while...
Successfully installed bitset-1.2.1
Parsing documentation for bitset-1.2.1
Installing ri documentation for bitset-1.2.1
Done installing documentation for bitset after 0 seconds
1 gem installed

Specs:

❯ rake spec
/Users/spozder/.rubies/ruby-3.1.5/bin/ruby -I/Users/spozder/.gem/ruby/3.1.5/gems/rspec-core-3.13.0/lib:/Users/spozder/.gem/ruby/3.1.5/gems/rspec-support-3.13.1/lib /Users/spozder/.gem/ruby/3.1.5/gems/rspec-core-3.13.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb --color
.................................................

Finished in 0.03824 seconds (files took 0.40695 seconds to load)
49 examples, 0 failures

@Spozder
Copy link
Author

Spozder commented Apr 30, 2024

We are looking at updating the gem for our own usage, it broke for some platforms with ruby 3.1.5. Feel free to merge this if y'all are still maintaining the repo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant